package com.cx.controller;

import com.cx.dto.HotelIndex;
import com.cx.dto.HotelRecommend;
import com.cx.service.impl.BrandMapperServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class Index {
    @Autowired
    BrandMapperServiceImpl brandService;
//    @RequestMapping("index1")
//    @ResponseBody
//    public HotelIndex index1(String brandName){
//        return brandService.selectByBrand(brandName);
//    }
//    @RequestMapping("index2")
//    @ResponseBody
//    public List<HotelRecommend> index2(String brandName){
//        return brandService.selectByBrandName(brandName);
//    }
    @RequestMapping("index")
    @ResponseBody
    public List<Object> index(String brandName){
//        System.out.println(brandName);
        List list = new ArrayList();
        HotelIndex hotelIndex = brandService.selectByBrand(brandName);
        List<HotelRecommend> hotelRecommends = brandService.selectByBrandName(brandName);
        list.add(hotelIndex);
        list.add(hotelRecommends);
        return list;

    }
}
